text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
set: [["zen.urlbar.replace-newtab", false]],
});
registerCleanupFunction(async () => {
await SpecialPow... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_Restore_Closed_Tabs() {
const tabsToIgnore = gBrowser.tabs;
const selected = gBrowser.selectedTab;
const tabsToClose = [];
for (let i = 0; i < 3... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>"use strict";
add_task(async function test_Invalid_Workspace_Name() {
const fakeWorkspace = {
name: "",
};
const icon = gZenWorkspaces.getWorkspaceIcon(fakeWorkspace);
Assert.equal(icon, fakeWorkspace.icon, "Test should not have crashed");
});
add_task(async function test_Invalid_Workspace_E... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> new Promise(resolve => {
/* eslint-disable-next-line mozilla/no-arbitrary-setTimeout */
setTimeout(() => {
// TODO: Use a real scroll position check instead of a hardcoded value
Assert.less(
scrollbox.scrollPosition,
60,
"The scrollbox should be scrolled to the... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>ed", false],
],
});
let privateWindow = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
await privateWindow.gZenWorkspaces.promiseInitialized;
Assert.ok(
privateWindow.gBrowser.selectedTab.hasAttribute("zen-empty-tab"),
"Private window should start with a zen e... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the<|fim_suffix|>org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_Private_Mode_Startup() {
let privateWindow = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
await privateWindow.gZenWorkspaces.promiseInitialized;
awai... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function fakeTab(workspaceId) {
return {
getAttribute(name) {
return name === "zen-workspace-id" ? workspaceId : null;
<|fim_suffix|>y {
// Remove the own property ... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_setup(async function () {});
// verify that with only one workspace, regular tabs should remain loaded
add_ta<|fim_suffix|>
await gZenWorkspaces.removeWorkspace(activeWorkspa... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
const TEST_URL = "about:buildconfig";
const TEST_URI = Services.io.newURI(TEST_URL);
function getToolbarNodeForItemGuid(aItemT... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> yield currentWindow;
}
}
}
var gWebProgressListener = {
_callback: null,
setCallback(aCallback) {
if (!this._callback) {
window.gBrowser.addTabsProgressListener(this);
}
this._callback = aCallback;
},
unsetCallback() {
if (this._callback) {
this._callback =... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>"The split view should not have crashed with two tabs in it"
);
});
ok(
!gBrowser.tabpanels.hasAttribute("zen-split-view"),
"Unsplit view should not have crashed with two tabs in it"
);
});
add_task(async function test_Browser_Elements_Attributes() {
await basicSplitNTabs(() => {
... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> tab.splitView,
"All tabs in the split group should be in a split view after duplication"
);
}
Assert.ok(
tab1.group.pinned,
"The split group should be pinned after duplication of both tabs"
);
for (const tab of tab1.group.tabs) {
await BrowserTestUtils.removeTab(tab);
... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_Basic_Split_Groups() {
await basicSplitNTabs(async tabs => {
ok(
tabs[0].group.hasAttribute("split-view-group"),
"The first tab should... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>ct inset style"
);
});
});
add_task(async function test_3_Splits_Grid_Inset() {
await basicSplitNTabs(
() => {
const viewsToCheck = document.querySelectorAll(
'.browserSidebarContainer[zen-split="true"]'
);
ok(viewsToCheck.length, "There should be split views present... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { UrlbarTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/UrlbarTestUtils.sys.mjs"
);
add_task(async function test_Split_View_Empty() {
await BrowserTe... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>ssert.equal(
tab2.group,
folder,
"The second pinned tab should be in the folder group"
);
await createSplitView([tab1, tab2], "grid");
Assert.strictEqual(
tab2.group,
tab1.group,
"The second pinned tab should be in the same split group after duplication"
);
ok(
tab1.g... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { openGlanceOnTab } = ChromeUtils.importESModule(
"resource://testing-common/GlanceTestUtils.sys.mjs"
);
add_task(async function test_Basic_Split_View_Glance() {
await ba... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
async function addTabTo(
targetBrowser,
url = "http://mochi.test:8888/",
params = {}
) {
params.skipAnimation = true;
const tab = BrowserTestUtils.addTab(targetBrowser, ur... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const URL1 = "data:text/plain,tab1";
const URL2 = "data:text/plain,tab2";
const URL3 = "data:text/plain,tab3";
const threshold = Math.min(
1.0,
Math.max(
0.5,
Services.... | fim | zen-browser/desktop | javascript |
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const URL1 = "data:text/plain,tab1";
const URL2 = "data:text/plain,tab2";
const URL3 = "data:text/plain,tab3";
add_task(async function test_blurToRecentlyClosedTab() {
const [tab1, tab2, tab3]... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>l tabs only, as the starting tab is a essential tab"
);
const workspaceTabs = gBrowser.tabs.filter(
tab =>
!tab.hasAttribute("zen-essential") && !tab.hasAttribute("zen-empty-tab")
);
await selectTab(workspaceTabs[0]);
gBrowser.tabContainer.advanceSelectedTab(1, true);
gBrowser.tabC... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test<|fim_suffix|>tab attribute"
);
ok(
emptyTab.linkedBrowser.hasAttribute("transparent"),
"Empty tab should have the transparent attribute"
)... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>ure that we are
// returning tabs correctly.
add_task(async function test_Tabs_Getter() {
for (let tab of gBrowser.tabs) {
Assert.strictEqual(
tab.tagName.toLowerCase(),
"tab",
"Each item in gBrowser.tabs is a tab element"
);
}
Assert.equal(
gBrowser.tabs.length,
2,... | fim | zen-browser/desktop | javascript |
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { TabGroupTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TabGroupTestUtils.sys.mjs"
);
function promiseTabLoadEvent(tab, url) {
info("Wait tab event: load");
f... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>AutocompleteResultPopup({
window,
waitForFocus,
value: label,
});
await new Promise(resolve =>
setTimeout(async () => {
let index =
typeof action.suggestedIndex === "number"
? action.suggestedIndex
: Infinity;
let { result }... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>mise = BrowserTestUtils.waitForEvent(
oneOffSearchButtons,
"rebuild"
);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
waitForFocus,
value,
});
await rebuildPromise;
}
function getWorkspaceShortcut() {
return [...oneOffSearchButtons.lo... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
ChromeUtils.defineESModuleGetters(this, {
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
});
add_task(async function test_Floating_Urlbar() {
gURLBar.blu... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
ChromeUtils.defineESModuleGetters(this, {
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
});
add_task(async function test_Selection_Remains_Double_Toolbar(... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>r();
await UrlbarTestUtils.promisePopupClose(window, () => gURLBar.blur());
await SimpleTest.promiseFocus(window);
await new Promise(resolve => setTimeout(resolve));
await TestUtils.waitForCondition(
() => gURLBar.value !== TYPED_VALUE,
"The address bar should revert away fro... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> { type: "mousemove" },
target.ownerGlobal
);
EventUtils.synthesizeMouse(
target,
toX,
rect.height / 2,
{ type: "mouseup" },
target.ownerGlobal
);
return promise;
}
function goToMultipleLayouts(callback) {
// eslint-disable-next-line no-async-promise-executor
return ne... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
SearchService: "moz-src:///toolkit/components/search/SearchService.sys.mjs",
});
/* eslint-disable mozilla/no-arbitrary-... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
async function goNextWelcomePage(l10nId) {
/* eslint-disable-next-line no-async-promise-executor *... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_SimpleLabelChange() {
let newLabel = "Test Label";
await withNewTabAndWindow(async (newTab, win) => {
let otherTab = gZenWindowSync.getItemFromW... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_SimpleTabOpen() {
await withNewTabAndWindow(async (newTab, win) => {
let tab<|fim_suffix|>;
});
});
<|fim_middle|>Id = newTab.id;
let otherT... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.or<|fim_suffix|>edWindow(async win => {
await runSyncAction(
() => {
newTab = gBrowser.addTrustedTab... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ZenCommonUtils.h"
#include "ZenShareInternal.h"
#include "nsGlobalWindowOuter.h"
#include... | fim | zen-browser/desktop | cpp |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_nsZenCommonUtils<|fim_suffix|>Utils() = default;
/**
* @brief Check if the curr... | fim | zen-browser/desktop | c |
<|fim_suffix|>* screen.
* @param aWindow The window to use for the share dialog.
* @param aUrl The URL to share.
* @param aTitle The title of the share.
* @param aText The text to share.
* @returns void
*/
static auto ShowNativeDialog(nsCOMPtr<mozIDOMWindowProxy>& aWindow,
... | fim | zen-browser/desktop | c |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ZenShareInternal.h"
#include "WindowsUIUtils.h"
namespace zen {
/**
* @brief Helper func... | fim | zen-browser/desktop | cpp |
<|fim_suffix|> {
anchor_attachment: "bottomcenter",
callout_attachment: "topleft",
},
},
],
content: {
position: "callout",
width: "355px",
title: {
str... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>,
{
name: "prettyNameTitle",
tag: "span",
},
],
},
{
name: "shortcutContent",
tag: "span",
classList: ["urlbarView-shortcutContent"],
},
],
};
}
onSearchSessionEnd(_queryConte... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtil... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> }
}
}
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { ProvidersManager } from "moz-src:///browser/components/urlbar/Url... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
let lazyD... | fim | zen-browser/desktop | javascript |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
{
let _tabsToPinEssentials = [];
let lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
SearchService: "... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>DownloadsButton",
"DownloadsIndicatorView",
"gEditItemOverlay",
"gGfxUtils",
"ToolbarKeyboardNavigator",
"A11yUtils",
"gSharedTabWarning",
"gPageStyleMenu",
"gProfiles",
"ContentPrefService2",
"classifierService",
"Favicons",
"WindowsUIUtils",
"BrowserHandler",
"Marionette",
... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
//<|fim_suffix|>
params: {
attrs: ["version", "y", "x", "id"],
},
},
],
};
<|fim_middle|> file, You can obtain one at http://mozilla.org/M... | fim | zen-browser/desktop | javascript |
<|fim_suffix|> if (m) {
globals[m[1]] = "readonly";
}
} else if (line.startsWith("var") || line.startsWith("let") || line.startsWith("const")) {
let m = line.match(/^(?:var|let|const)\s+([\w\$]+)\s*[;=]/);
if (m) {
globals[m[1]] = "readonly";
}
} else if (line.startsWith(... | fim | zen-browser/desktop | javascript |
<|fim_prefix|>/**
* @file A processor to h<|fim_suffix|> of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
"use strict";
// ------------------------------------------------------------------------------
// Plug... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>x;
}
}
result.push(message);
}
return result;
},
supportsAutofix: true,
};
<|fim_prefix|>/**
* @file Remove macros from SpiderMonkey's self-hosted JS.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was n... | fim | zen-browser/desktop | javascript |
<|fim_suffix|>on static prefs")
);
let content = format!("{}{}{}{}{}", name, cpp_type, value, mirror, rust);
get_pref_with_condition(&content, &get_condition_string(&pref.condition))
}
fn get_dynamic_pref(pref: &Preference) -> String {
let value = get_value(pref);
if pref.hidden.unwrap_or(false) {
... | fim | zen-browser/desktop | rust |
<|fim_prefix|>
#include <vector>
#include <string>
#include <functional>
#ifndef __MALWARE_SNITCH_APP_H_
#define __MALWARE_SNITCH_APP_H_
namespace malware_snitch {
/**
* @struct AppArgs
* @brief Data structure to hold the API key and files.
*/
struct AppArgs {
std::string api_key; ///< The API key for VirusTota... | fim | zen-browser/desktop | c |
<|fim_suffix|>.push_back(CalculateSHA256(file));
}
return hashes;
}
auto Hasher::CalculateSHA256(const std::string& aFile) -> std::string {
auto hash = CalculateSHA256Helper(aFile);
std::cout << "\t[+] Hashed: " << aFile << " -> " << hash << std::endl;
return hash;
}
}; // namespace malware_snitch
<|fim_pre... | fim | zen-browser/desktop | cpp |
<|fim_suffix|>CalculateSHA256Helper(const std::string& aFile) -> std::string;
/**
* @brief Converts a hash to a string.
* @param hash The hash data.
* @param length The length of the hash.
* @return The hash as a string.
*/
template <size_t N>
static auto HashToString(const std::arr... | fim | zen-browser/desktop | c |
<|fim_prefix|>
#include "app.h"
#include "scanner.h"
#include <iostream>
#include <vector>
#include <string>
#include <optional>
namespace malware_snitch {
namespace {
/// @brief Function to convert C argv into a vector of strings
/// @param argc The number of command line arguments.
/// @param argv The command line... | fim | zen-browser/desktop | cpp |
<|fim_suffix|>URLE_OK) {
std::cerr << "\nError: " << curl_easy_strerror(ret) << std::endl;
exit(EXIT_FAILURE);
}
std::cout << "\t[+] Response: " << response << std::endl;
auto jsonResponse = json::parse(response);
auto uploadUrl = jsonResponse["data"];
}
return json();
}
auto Scanner:... | fim | zen-browser/desktop | cpp |
<|fim_suffix|>NER_H_<|fim_prefix|>
#ifndef __MALWARE_SNITCH_SCANNER_H_
#define __MALWARE_SNITCH_SCANNER_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vector>
#include <string>
#include <memory>
#include <json.hpp>
#define VIRUS_TOTAL_API_URL "https://www.virustotal.com/... | fim | zen-browser/desktop | c |
<|fim_suffix|>);
};
<|fim_prefix|>var webpackConfig = require('./webpack.config.js');
module.exports = <|fim_middle|>function (karma) {
karma.set({
plugins: [
'karma-webpack',
'karma-chai',
'karma-sinon',
'karma-mocha',
'karma-chrome-launcher',
],
frameworks: ['chai', 'sino... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>// Package metadata for Meteor.js.
Package.describe({
name: 'zenorocha:clipboard',
summary: 'Modern copy to clipboard. No Flash. Just 3kb.',
<|fim_suffix|>
api.addFiles('dist/clipboard.js', 'client');
});
<|fim_middle|> version: '2.0.11',
git: 'https://github.com/zenorocha/clipboard.js',
});
Pa... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|>iner.appendChild(fakeElement);
const selectedText = select(fakeElement);
command('copy');
fakeElement.remove();
return selectedText;
};
/**
* Copy action wrapper.
* @param {String|HTMLElement} target
* @param {Object} options
* @return {String}
*/
const ClipboardActionCopy = (
target,
o... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import select from 'select';
import command from '../common/command';
/**
* Cut action wrapper.
* @param {String|HTMLElement} target
* @return {String}
*/
<|fim_suffix|>t ClipboardActionCut;
<|fim_middle|>const ClipboardActionCut = (target) => {
const selectedText = select(target);
command('cut')... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import ClipboardActionCut from './cut';
import ClipboardActionCopy from './copy';
/**
* Inner function which performs selection from either `text` or `target`
* properties and then executes copy or cut operations.
* @param {Object} options
*/
const ClipboardActionDefault = (options = {}) => {
// De... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|> * Overwrites default target input element.
* @param elem Current element
* @returns <input> element to use.
*/
target?(elem: Element): Element;
/**
* Returns the explicit text to copy.
* @param elem Current element
* @returns Text to be copied.
*/
text?(e... | fim | zenorocha/clipboard.js | typescript |
<|fim_suffix|>tically a cut action
* @param {String|HTMLElement} target
* @returns Text cutted.
*/
static cut(target) {
return ClipboardActionCut(target);
}
/**
* Returns the support of the given action, or all actions if no action is
* given.
* @param {String} [action]
*/
static isSup... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import { expectType } from 't<|fim_suffix|>ard';
expectType<Clipboard>(new Clipboard('.btn'));
<|fim_middle|>sd';
import * as Clipboard from './clipbo<|endoftext|> | fim | zenorocha/clipboard.js | typescript |
<|fim_prefix|>/**
* Executes a given operation type.
* @param {String} type
* @return {Boolean}
*/
export default function command(type) {
try {
return document.execCommand(type)<|fim_suffix|>
}
<|fim_middle|>;
} catch (err) {
return false;
}<|endoftext|> | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|>`;
fakeElement.setAttribute('readonly', '');
fakeElement.value = value;
return fakeElement;
}
<|fim_prefix|>/**
* Creates a fake textarea element with a value.
* @param {String} value
* @return {HTMLElement}
*/
export default function createFakeElement(value) {
const isRTL = document.documen... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|> }
);
assert.equal(Number(selectedText), value);
});
});
});
<|fim_prefix|>import ClipboardActionCopy from '../../src/actions/copy';
describe('ClipboardActionCopy', () => {
before(() => {
global.input = document.createElement('input');
global.input.setAttribute('id', 'input... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import ClipboardActionCut from '../../src/actions/cut';
describe('ClipboardActionCut', () => {
before(() => {
global.input = document.createElement('input');
global.input.setAttribute('id', 'input');
global.input.setAttribute('value', 'abc');
document.body.appendChild(global.input);
... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import ClipboardActionDefault from '../../src/actions/default';
describe('ClipboardActionDefault', () => {
before(() => {
global.input = document.createElement('input');
global.input.setAttribute('id', 'input');
global.input.setAttribute('value', 'abc');
document.body.appendChild(global... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>import Clipboard from '../src/clipboard';
describe('Clipboard', () => {
before(() => {
global.button = document.createElement('button');
global.button.setAttribute('class', 'btn');
global.button.setAttribute('data-clipboard-text', 'foo');
document.body.appendChild(global.button);
g... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|>
assert.isFalse(command('copy'));
done();
});
it('should not execute cut', (done) => {
global.stub.returns(false);
select(document.querySelector('#input'));
assert.isFalse(command('cut'));
done();
});
});
<|fim_prefix|>import select from 'select';
import command from '../..... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|>);
assert.equal(el.style.right, '-9999px');
done();
});
});
<|fim_prefix|>import createFakeElement from '../../src/common/create-fake-element';
describe('createFakeElement', () => {
it('should define a fake element and set the position right style property', (done) => {
// Set document d... | fim | zenorocha/clipboard.js | javascript |
<|fim_prefix|>const pkg = require('./package.json');
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('u<|fim_suffix|> beautify: false,
comments: (node, { value, type }) =>
type == 'comment2' && value.startsWith('!'),
},
... | fim | zenorocha/clipboard.js | javascript |
<|fim_suffix|>hyr/toolchain.h>
__weak void *__dso_handle;
int atexit(void (*function)(void))
{
return 0;
}
<|fim_prefix|>/*
* Copyright (c) 2021<|fim_middle|> Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zep<|endoftext|> | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ARCv2 ARC CONNECT driver
*
*/
#include <zephyr/kernel.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/spinlock.h>
#include <kernel_internal.h>
static struct k_spinlock arc_connect_spinlock;
/* Ge... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* cache.c - d-cache support for ARC CPUs */
/*
* Copyright (c) 2016 Synopsys, Inc. All rights reserved.
* Copyright (c) 2025 GSI Technology, All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief d-cache manipulation
*
* This module contains functions for manipula... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2022 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ARCv2 DSP and AGU structure member offset definition file
*
*/
#ifdef CONFIG_DSP_SHARING
GEN_OFFSET_SYM(_callee_saved_stack_t, dsp_ctrl);
GEN_OFFSET_SYM(_callee_saved_stack_t, acc0_glo);
GEN_OFFSET_SYM(_callee_sav... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>stack_t_agu_mod10_OFFSET]
sr r13, [_ARC_V2_AGU_MOD10]
ld r13, [sp, ___callee_saved_stack_t_agu_mod11_OFFSET]
sr r13, [_ARC_V2_AGU_MOD11]
#endif
#ifdef CONFIG_ARC_AGU_LARGE
ld r13, [sp, ___callee_saved_stack_t_agu_ap8_OFFSET]
sr r13, [_ARC_V2_AGU_AP8]
ld r13, [sp, ___callee_saved_stack_t_agu_ap9_OFFS... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>(rel->r_info);
switch (reloc_type) {
case R_ARC_32:
case R_ARC_B26:
UNALIGNED_PUT(sym_base_addr, (uint32_t *)loc);
break;
case R_ARC_S25H_PCREL:
/* ((S + A) - P) >> 1
* S = symbol address
* A = addend
* P = relative offset to PCL
*/
value = (sym_base_addr + rel->r_addend - (loc & ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>FUNC_NORETURN void arch_system_halt(unsigned int reason)
{
ARG_UNUSED(reason);
__asm__("brk");
CODE_UNREACHABLE;
}
<|fim_prefix|>/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Fatal fault handling
*
* This module implements th... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>l mode");
break;
case 0x40:
EXCEPTION_DUMP("SID violation on resource access (APEX/UAUX/key NVM)");
break;
default:
EXCEPTION_DUMP("unknown");
break;
}
break;
case 0x13:
switch (parameter) {
case 0x20:
EXCEPTION_DUMP("attempt to access secure APEX feature from NS mode");
... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ARCv2 interrupt management
*
*
* Interrupt management:
*
* - enabling/disabling
*
* An IRQ number passed to the @a irq parameters found in this file is a
* number from 16 to last IRQ number on... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_IRQS - 3)
#endif
#define IRQ_OFFLOAD_PRIO 0
#define CURR_CPU (IS_ENABLED(CONFIG_SMP) ? arch_curr_cpu()->id : 0)
static struct {
volatile irq_offload_routine_t fn;
const void *volatile arg;
} offload_params[CONFIG_MP_MAX_NUM_CPUS];
static void arc_irq_offload_handler(const void *unused)
{
ARG_UNUSE... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2017 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/arch/arc/v2/mpu/arc_core_mpu.h>
/*
* @brief Configure MPU for the thread
*
* This function configures per thread memory map ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>APP_DATA_REGION:
return REGION_RAM_ATTR;
case THREAD_STACK_GUARD_REGION:
/* no Write and Execute to guard region */
return AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR;
default:
/* unknown type */
return 0;
}
}
#if (CONFIG_ARC_MPU_VER == 4) || (CONFIG_ARC_MPU_VER == 8)
#include "arc_mpu_v4_internal.h"
... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2021 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_COMMON_INTERNAL_H_
#define ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_COMMON_INTERNAL_H_
#if CONFIG_ARC_MPU_VER == 2 || CONFIG_ARC_MPU_VER == 3
#include "arc_mpu_v2_internal.h"
#elif CONFIG_ARC_MPU_VER == 6
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>c_v2_aux_reg_write(_ARC_V2_MPU_RDB0 + index, region_addr);
}
/**
* This internal function is utilized by the MPU driver to parse the intent
* type (i.e. THREAD_STACK_REGION) and return the correct region index.
*/
static inline int get_region_index_by_type(uint32_t type)
{
/*
* The new MPU regions ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V4_INTERNAL_H_
#define ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V4_INTERNAL_H_
#define AUX_MPU_RPER_SID1 0x10000
/* valid mask: SID1+secure+valid */
#define AUX_MPU_RPER_VALID_MASK ((0x... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2021 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V6_INTERNAL_H_
#define ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V6_INTERNAL_H_
#define AUX_MPU_EN_BANK_MASK BIT(0)
#define AUX_MPU_EN_IC BIT(12)
#define AUX_MPU_EN_DC BIT(13)
#define AUX_MP... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ARCv2 kernel structure member offset definition file
*
* This module is responsible for the generation of the absolute symbols whose
* value represents the member offsets for various ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Full C support initialization
*
*
* Initialization of full C support: zero the .bss, copy the .data if XIP,
* call z_cstart().
*
* Stack is available in this module, but not the gl... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2018 Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <errno.h>
#include <zephyr/types.h>
#include <zephyr/init.h>
#include <zephyr/toolchain.h>
#include <zephyr/arch/arc/v2/secureshield/a... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2018 Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/types.h>
#include <zephyr/toolchain.h>
#include <zephyr/arch/arc/v2/secureshield/arc_secure.h>
#define IR... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief codes required for ARC multicore and Zephyr smp support
*
*/
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#include <ipi.h>
#include <zephyr/init.h>
#include <zephyr/p... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> void *p3,
void *main_stack, void *main_entry);
FUNC_NORETURN void z_arc_switch_to_main_no_multithreading(k_thread_entry_t main_entry,
void *p1, void *p2, void *p3)
{
_kernel.cpus[0].id = 0;
_kernel.cpus[0].irq_stack = (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
K_KERNEL_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> * @return 64-bit time stamp value
*/
uint64_t z_tsc_read(void)
{
unsigned int key;
uint64_t t;
uint32_t count;
key = arch_irq_lock();
t = (uint64_t)sys_clock_tick_get();
count = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
arch_irq_unlock(key);
t *= k_ticks_to_cyc_floor64(1);
t += (uint64_t)coun... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <kernel_internal.h>
#include <kernel_tls.h>
#include <zephyr/sys/util.h>
#ifdef __CCAC__
extern char _arcmwdt_tls_start[];
extern char _arcmwdt_tls_size[];
size_t arch_tls_stack_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>sion,
(uintptr_t)__ev_div_zero,
(uintptr_t)__ev_dc_error,
(uintptr_t)__ev_maligned,
0,
0
};
<|fim_prefix|>/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Populated exception vector table
*
* Vector table with exceptions filled ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_ARCH_ARC_INCLUDE_ARC_IRQ_OFFLOAD<|fim_suffix|>else
static inline void arc_irq_offload_init_smp(void) {}
#endif /* CONFIG_IRQ_OFFLOAD */
#endif /* ZEPHYR_ARCH_ARC_INCLUDE_ARC_IRQ_OFFLOAD_H_ */
<|fim_middle|>... | fim | zephyrproject-rtos/zephyr | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.